package com.dong.sqltoy.tenant;

import lombok.extern.slf4j.Slf4j;
import org.sagacity.sqltoy.plugins.SqlInterceptor;
import org.sagacity.sqltoy.plugins.interceptors.TenantFilterInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author dengxiudong
 * @Date 2025/9/25 18:25
 */
@Slf4j
@Configuration
public class SqlToyTenantConfig {
    /**
     * 配置租户过滤器
     *
     * @return
     */
    @Bean
    public SqlInterceptor tenantSqlInterceptor() {
        TenantFilterInterceptor interceptor = new TenantFilterInterceptor();
        return interceptor;
    }
    
    @Bean
    public UnifyFieldsAutoFillHandler unifyFieldsAutoFillHandler() {
        System.out.println("-----------初始化统一字段填充处理器-------------");
        Set<String> set = new HashSet<>();
        // set.add("user");
        return new UnifyFieldsAutoFillHandler(set);
    }
}